package com.itcg.springboot02demo01.controller;

import com.itcg.springboot02demo01.config.MyProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/hello")
public class HelloController {
    //注入application.properties配置文件中的属性值
    //@Value("${com.itcg.springboot02demo01.controller.username}")
    //private String username;
    //@Value("${com.itcg.springboot02demo01.controller.password}")
    //private String password;
    //@Value("${com.itcg.springboot02demo01.controller.url}")
    //private String url;

    //@RequestMapping("/props")
    //public String props() {
    //    return username + "-------" + password + "-------" + url;
    //}

    @Autowired
    private MyProperties myProperties;

    @RequestMapping("/myprops")
    public MyProperties myProperties() {
        return myProperties;
    }


}
